#ifndef CODE_INCLUDE_BASE_NET_I_SESSION_H_
#define CODE_INCLUDE_BASE_NET_I_SESSION_H_

#include <stdlib.h>
#include <stdint.h>

struct IP_ADDRESS 
{
    uint16_t port;
    char     IP[sizeof("255.255.255.255")];
    char     IPAndPort[sizeof("255.255.255.255:65535")];
};

struct SESSION_USER_DATA 
{
      uint32_t  v32;
      uint64_t  v64;
      void*     ptr;
      SESSION_USER_DATA() : v32(0), v64(0), ptr(NULL) {}
};

class ISession 
{
public:
    virtual void GetUserReq(void** retReq, void** retContext) = 0;
    virtual void SetUserReq(void* req, void* context) = 0;

    virtual const SESSION_USER_DATA& GetUserData() = 0;
    virtual void SetUserData(const SESSION_USER_DATA& data) = 0;

    virtual void* GetNetPackHandle() = 0;
    virtual void  SetNetPackHandle(void* netpackhandle) = 0;

    virtual const IP_ADDRESS& GetRemoteAddress() = 0;
    virtual uint16_t    GetLocalPort() = 0;

    virtual uint16_t GetMark() = 0;
    virtual void SetMark(uint16_t mark) = 0;

    virtual bool GetEncrypt() = 0;
    virtual void SetEncrypt(bool encrypt) = 0;

	virtual uint32_t GetReadSize() = 0;
	virtual uint32_t GetWriteSize() = 0;
	virtual uint32_t GetWriteOffset() = 0;
	virtual uint32_t GetReadLen() = 0;

protected:
    ISession() {}
    virtual ~ISession() {}
};

bool MakeIPAddress(IP_ADDRESS *IPAddress, const char *IP, uint16_t port);

#endif  // CODE_INCLUDE_BASE_NET_I_SESSION_H_
